/*
 * Server.h
 *
 *  Created on: Sep 8, 2012
 *      Author: dimir
 */

#ifndef SERVER_H_
#define SERVER_H_

#include "Message.h"
#include "Debug.h"
#include <vector>
#include <utility>
#include <cstdio>

#define ID(a) (a).second
#define PTR(a) (a).first

class Client;

class Server {
	std::vector< std::pair<Client*,unsigned long int> > clnts;
	int send(Message& msg, u_int32_t id);
	int recv(Message& msg);
	bool sync;
	void sleep();
	void ready();
public:
	Server();
	bool synchro();
	virtual ~Server();

	friend class Client;
};

#endif /* SERVER_H_ */
